/*
using MyGeneration/Template/NHibernate (c) by lujan99@usa.net
*/
using System;

namespace Rodunu.Movies.Contracts
{
    /// <summary>
    /// ServicsMovieLink object for NHibernate mapped table 'ServicsMovieLink'.
    /// </summary>
    [Serializable]
    public class ServicesMovieLink : IIdentifier
    {
        #region Member Variables

        protected string _amazonid;
        protected long _id;
        protected string _imdbid;
        protected Movie _movie;
        protected string _netflixid;
        protected UserInfo _userinfo;

        #endregion

        #region Constructors

        public ServicesMovieLink()
        {
        }

        public ServicesMovieLink(Movie movie, UserInfo userinfo, string imdbid, string netflixid, string amazonid)
        {
            _movie = movie;
            _userinfo = userinfo;
            _imdbid = imdbid;
            _netflixid = netflixid;
            _amazonid = amazonid;
        }

        public ServicesMovieLink(Movie movie, UserInfo userinfo)
        {
            _movie = movie;
            _userinfo = userinfo;
        }

        #endregion

        #region Public Properties

        public virtual Movie Movie
        {
            get { return _movie; }
            set { _movie = value; }
        }

        public virtual UserInfo UserInfo
        {
            get { return _userinfo; }
            set { _userinfo = value; }
        }

        public virtual string ImdbId
        {
            get { return _imdbid; }
            set { _imdbid = value; }
        }

        public virtual string NetflixId
        {
            get { return _netflixid; }
            set { _netflixid = value; }
        }

        public virtual string AmazonId
        {
            get { return _amazonid; }
            set { _amazonid = value; }
        }

        public virtual long Id
        {
            get { return _id; }
            set { _id = value; }
        }

        #endregion

        #region Equals And HashCode Overrides

        /// <summary>
        /// local implementation of Equals based on unique value members
        /// </summary>
        public override bool Equals(object obj)
        {
            if (this == obj) return true;
            if ((obj == null) || (obj.GetType() != GetType())) return false;
            var castObj = (ServicesMovieLink) obj;
            return (castObj != null) &&
                   _id == castObj.Id;
        }

        /// <summary>
        /// local implementation of GetHashCode based on unique value members
        /// </summary>
        public override int GetHashCode()
        {
            int hash = 57;
            hash = 27*hash*_id.GetHashCode();
            return hash;
        }

        #endregion
    }
}